<template>
	<view class="uiwu">
		<uiwu-list :loading="more">
			<view class="uiwu-list">
				<view class="uiwu-list-item" v-for="(item, index) in listData" :key="index">
					<view class="time">{{ item.add_time }}</view>
					<view class="item">
						<view class="box">
							<view class="title">{{ item.title }}</view>
							<view class="content uiwu-hidden2">{{ item.content }}</view>
						</view>
					</view>
				</view>
			</view>
		</uiwu-list>
	</view>
</template>

<script setup lang="ts">
import { messagelist, uiwu } from '@/api/interface/interface';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import { ref } from 'vue';
const listData = ref<Array<object>>([])
const pageNum = ref<number>(1)
const more = ref<string>('loading');
const isLock = ref<boolean>(true)
const getmoneylist = async (mack: boolean = false): Promise<any> => {
	if (!mack) pageNum.value = 1
	const { data: { data, total } } = await messagelist({
		page: pageNum.value
	});
	isLock.value = true
	uiwu.setlist({
		isMore: mack,
		listData,
		total,
		listRow: data,
		more,
		pageNum
	})
}
/**
 * 加载更多
 */
onReachBottom(() => {
	if (!isLock.value) return
	isLock.value = false
	pageNum.value++
	getmoneylist(true)
})
onLoad(() => {
	getmoneylist()
})
</script>

<style lang="scss" scoped>
//统一样式格式化
view,
text,
button,
input,
textarea,
navigator {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

//button按钮特殊处理
button {
	&::after {
		border: 0;
		padding: 0;
		margin: 0;
	}
}

//图片默认格式处理，防止切换页面导致图片闪烁
image {
	will-change: transform;
	width: 0;
	height: 0;
}

page {
	background-color: #F6F6F6;
}

.uiwu-list {
	padding: 0 24rpx;
	padding-right: 12rpx;

	&-item {
		.time {
			font-size: 24rpx;
			font-weight: 400;
			color: #444444;
			text-align: center;
			padding: 24rpx 0 32rpx;
		}

		.item {
			width: 100%;
			height: 206rpx;
			background: $qj-red;
			border-radius: 24rpx;
			border: 3rpx solid #231815;
			margin-bottom: 32rpx;

			.box {
				width: 100%;
				height: 206rpx;
				background: #FFFFFF;
				border-radius: 16rpx;
				border: 3rpx solid #231815;
				margin-top: -12rpx;
				margin-left: -12rpx;
				padding: 24rpx;

				.title {
					font-size: 32rpx;
					font-weight: 800;
					color: #231815;
				}

				.content {
					font-size: 28rpx;
					font-weight: 500;
					color: #666666;
					margin-top: 12rpx;
				}
			}
		}
	}
}
</style>
